
package com.sxkj.service.wechat;

import com.github.pagehelper.PageInfo;
import com.sxkj.entity.entity.wechat.WechatUser;
import com.sxkj.entity.mapper.wechat.WechatUserMapper;
import com.sxkj.service.base.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author Zhang Xingliang
 *
 * @description: 微信用户
 * @date 2019-12-25 09:39:56
 */
@Service
public class WechatUserService extends BaseService<WechatUserMapper,WechatUser> {

	/**
	* 获取单条数据
	* @param id
	* @return WechatUser
	*/
	public WechatUser get(String id) throws Exception{
		return super.get(id);
	}
	
	/**
	* 获取单条数据
	* @param wechatUser
	* @return WechatUser
	*/
	public WechatUser get(WechatUser wechatUser) throws Exception{
		return super.get(wechatUser);
	}
	
	/**
	* 查询列表数据
	* @param wechatUser
	* @return List<WechatUser>
	*/
	public List<WechatUser> findList(WechatUser wechatUser) throws Exception{
		return super.findList(wechatUser);
	}

	/**
	* 查询分页数据
	* @param wechatUser
	* @param pageSize
	* @param pageNum
	* @return Page
	*/
	public PageInfo findPage(WechatUser wechatUser, Integer pageSize, Integer pageNum) throws Exception{
		return super.findPage(wechatUser, pageSize, pageNum);
	}

	/**
	* 保存数据（插入或更新）
	* @param wechatUser
	*/
	@Transactional(rollbackFor = Exception.class)
	public void save(WechatUser wechatUser) throws Exception{

		super.save(wechatUser);
	}


	/**
	* 删除数据
	* @param wechatUser
	*/
	@Transactional(rollbackFor = Exception.class)
	public void delete(WechatUser wechatUser) throws Exception{
		super.delete(wechatUser);
	}

	/**
	 * @author Zhang Xingliang
	 * @description 通过openid获取微信用户信息
	 * @date 16:24 2019/12/25
	 * @param openid
	 * @return com.sxkj.entity.entity.wechat.WechatUser
	 **/
	public WechatUser getWechatUserByOpenid(String openid) throws Exception{
		return baseMapper.getWechatUserByOpenid(openid);
	}
}